// product catalogue tree view

body.caerp .tree_view {
	text-align: left;

	ul {
		list-style-type: none;

		input:checked+span {
			font-weight: bold;
		}

		li {
			font-size: .825rem;
			position: relative;
		}
	}

	>ul {
		align-items: flex-start;
		display: flex;
		flex-wrap: wrap;
		margin-top: var(--padding-s);

		>li {
			padding-right: var(--padding-m);
			position: relative;
		}
	}

	ul ul {
		li {
			padding-left: 3.5rem;
			position: relative;

			&::before,
			&::after {
				content: "";
				border: 1px dotted var(--border-color);
				left: 2.5rem;
				position: absolute;
				width: 1rem;
			}

			&::before {
				top: 0;
			}

			&:not(:last-child)::before {
				bottom: 0;
				border-width: 0 0 0 1px;
			}

			&:last-child::before {
				border-width: 0 0 1px 1px;
				height: .9rem;
			}

			&:not(:last-child)::after {
				border-width: 0 0 1px 0;
				top: .9rem;
			}

			&:last-child::after {
				display: none;
			}

			small {
				display: block;
			}
		}
	}

	p {
		padding: var(--padding-s) 0;
	}

	.collapsible+.collapsible {
		margin-top: 0;
	}

	button[aria-expanded] {
		all: inherit;
		cursor: pointer;
		left: 0;
		padding: var(--padding-s);
		position: absolute;
		top: 0;

		&:hover,
		&:focus,
		&:active {
			box-shadow: none;

			svg {
				fill: var(--form-icon-button-hover-color);
			}
		}

		+label {
			margin-left: 2rem;
			width: calc(100% - 1rem);
		}
	}

	&.with_actions {
		ul {
			li {
				padding: 2rem 3.5rem .5rem 0;

				.actions {
					right: 0;
					position: absolute;
					top: 3.5rem;

					button {
						margin: 0;
					}
				}

				.combination {
					left: -2.5rem;
					position: absolute;
					top: -.125rem;

					.icon_choice label input+span {
						padding-bottom: 0;
						padding-top: 0;
						text-align: center;
						width: 2.5rem;
					}
				}

				&.add_line {
					height: 5rem;
					padding-top: 0;

					.actions {
						left: 3rem;
						top: 2rem;
						right: auto;
					}
				}

				>ul {
					margin-left: 3.5rem;
					margin-right: -3.5rem;
				}

				&:last-child::after {
					border-width: 0 0 1px 1px;
					bottom: 2rem;
					display: block;
					left: 0;
					top: 1rem;
					width: 3rem;
				}
			}
		}

		ul ul {
			li {
				padding-left: 3rem;

				&::before,
				&::after {
					left: 0;
					width: 100%;
				}
			}

			li:first-child:not(:only-child) {
				margin-top: 1.75rem;

				.combination {
					left: -3.75rem;
					top: -1.75rem;
				}
			}
		}
	}

	&.first_level {
		div>ul:first-child {
			padding-left: 2rem;

			>li {
				padding-left: 3rem;

				&::before,
				&::after {
					content: "";
					border: 1px dotted var(--border-color);
					left: 0;
					position: absolute;
					width: 100%;
				}

				&::before {
					top: 0;
				}

				&:first-child::before {
					top: 4.5rem;
				}

				&:first-child::after {
					border-width: 1px 0 0 0;
					display: block;
					top: 4.5rem;
					width: 2.5rem;
				}

				&:not(:last-child)::before {
					bottom: 0;
					border-width: 0 0 0 1px;
				}

				&:last-child::before {
					border-width: 0 0 1px 1px;
					height: .9rem;
				}

				&:not(:first-child):not(:last-child)::after {
					border-width: 0 0 1px 0;
					top: .9rem;
				}

				&:last-child::after {
					border-width: 0 0 1px 1px;
					width: 3rem;
				}
			}
		}
	}
}

body.caerp table .tree_view>ul {
	max-height: 18em;
	overflow-y: auto;
}

body.caerp .main_area aside .tree_view {
	>ul>li {
		max-width: 100%;
	}
}

@media (min-width: $wideWidth ) {
	body.caerp .tree_view {
		>ul>li {
			max-width: 33.3333%;
			padding-right: var(--padding-xl);
		}
	}
}